
int enablePin = 8;  // pin 1 on L293D
int motor1Pin1 = 9; // pin 2 on L293D
int motor1Pin2 = 10; // pin 7 on L293D


void setup() {

    // set all the other pins you're using as outputs:
    pinMode(motor1Pin1, OUTPUT);
    pinMode(motor1Pin2, OUTPUT);
    pinMode(enablePin, OUTPUT);

    // set enablePin high so that motor can turn on:
    digitalWrite(enablePin, HIGH);
}

void loop() 
{
    
    //Motor will turn on one direction:
    digitalWrite(enablePin, HIGH);
    digitalWrite(motor1Pin1, LOW); // set pin 2 on L293D low
    digitalWrite(motor1Pin2, HIGH); // set pin 7 on L293D high
    delay(2000);

    //pause   
    digitalWrite(enablePin, LOW);
    delay(1000);
   
    //Motor will turn in the opposite direction:
    digitalWrite(enablePin, HIGH);
    digitalWrite(motor1Pin1, HIGH); // set pin 2 on L293D high
    digitalWrite(motor1Pin2, LOW); // set pin 7 on L293D low    
    delay(2000);
    
    //pause
    digitalWrite(enablePin, LOW);
    delay(1000);
    
}
